<?php
// load the user for this comment and cache them for future use
// p.s. WORST PLACE EVER for this code
if (isset($COMMENT_USERS[$comment->author_id]))
	$cmt_user = $COMMENT_USERS[$comment->author_id];
else
{
	$query 	  = $this->db->query('select * from users where id = ? limit 1', $comment->author_id);
	$cmt_user = $query->first_row();
	$COMMENT_USERS[$comment->author_id] = $cmt_user;
}
?>
<div class="comment" id="comment_<?php echo $comment->id; ?>">
	<p class="author">
		<a href="/<?php echo $this->uri->segment(1); ?>/<?php echo user_url($cmt_user); ?>"><img class="profile_avatar" src="<?php echo url_for_avatar($cmt_user->avatar, $cmt_user->id, 'user', 'small'); ?>" alt="<?php echo $cmt_user->login; ?>" width="25" height="25" /></a>
		<a href="/<?php echo $this->uri->segment(1); ?>/<?php echo user_url($cmt_user); ?>"><?php echo username($cmt_user); ?></a> said: <span class="when"><?php echo strtolower(timespan(strtotime($comment->created_at))); ?> ago</span></p>
	<div class="body">
		<?php echo auto_typography($comment->text); ?>
	</div>
</div>